

<cfif IsUserInRole("Super User")>

	
	
	<script>
		var CLIENT_ID = "619995598188-avf2iigemic50dgev3jdbvjkot0qh8hq.apps.googleusercontent.com";
		var SCOPES = ["https://www.googleapis.com/auth/drive"];
		
		/**
		* Called when the client library is loaded to start the auth flow.
		*/
		function onLoad() {
			console.log(gapi);
			window.setTimeout(checkAuth, 1);
		}
		
		/**
		* Check if the current user has authorized the application.
		*/
		function checkAuth() {
			var s = typeof SCOPES === "array" ? SCOPES.join(' '): SCOPES;
			gapi.auth.authorize(
				{"client_id": CLIENT_ID, "scope": s, "immediate": true},
				handleAuth
			);
		}
		
		function handleAuth(authResult, callback) {
			var callback = callback || function() {};
			if (authResult) {
				// Auth successful, load Drive API and forward to callback
				//gapi.client.load("drive", "v2" callback);
				//listChildren();
				listFolders();
			} else {
				// No access token, force authorization
				var s = typeof SCOPES === "array" ? SCOPES.join(' '): SCOPES;
				gapi.auth.authorize(
					{"client_id": CLIENT_ID, "scope": s, "immediate": false},
					handleAuth
				);
			}
		}
		
		function loadDrive(callback) {
			var callback = callback || function(){};
			gapi.client.load("drive", "v2", callback);
		}
		
		function listFolders() {
			var qry = "mimeType = 'application/vnd.google-apps.folder' and trashed = false";
			var request = gapi.client.drive.files.list({
				corpus: "DOMAIN",
				q: qry
			})
			request.execute(function(resp) {
				if (!resp.error) {
					console.log(resp);
				} else if (res.error.code == 401) {
					checkAuth();
				} else {
					alert(resp.error.message);	
				}
			});
		}
		// resources: https://drive.google.com/folderview?id=0ByOEp31ChEw2ZHJPZGgyTjllbkU&usp=sharing
		// 
		function listFiles(folder) {
			var qry = "mimeType != 'application/vnd.google-apps.folder' and trashed = false";
			var request = gapi.client.drive.files.list({
				corpus: "DOMAIN",
				q: qry
			});
			request.execute(function(resp) {
				if (!resp.error) {
					console.log(resp);
					getFile();
				} else if (res.error.code == 401) {
					checkAuth();
				} else {
					alert(resp.error.message);
				}
			});
		}
		
		function listChildren(folderId) {
			var folderId = folderId || "0ByOEp31ChEw2ZHJPZGgyTjllbkU";
			var request = gapi.client.drive.children.list({
				folderId: folderId
			})
			request.execute(function(resp) {
				if (!resp.error) {
					console.log(resp);
				} else if (res.error.code == 401) {
					checkAuth();
				} else {
					alert(resp.error.message);
				}
			});
		}
		
		function getFile(fileId) {
			var fileId = fileId || "";
			var request = gapi.client.drive.files.get({
				"fileId": "0ByOEp31ChEw2QURXU0didkVnaEE"
			})
			request.execute(function(resp) {
				var isRestricted = resp.labels.restricted;
				console.log(resp);
				if (isRestricted) {
					console.log("The preceding file is restricted");
				}
			})
		}

		function createPublicFolder(folderName) {
			var body = {
				"title": folderName,
				"mimeType": "application/vnd.google-apps.folder"
			};
			
			var request = gapi.client.drive.files.insert({
				"resource": body
			});
			
			request.execute(function(resp) {
				console.log('Folder ID: ' + resp.id);
				var permissionBody = {
					"value": "",
					"type": "anyone",
					"role": "reader"
				};
				var permissionRequest = gapi.client.drive.permissions.insert({
					"fileId": resp.id,
					"resource": permissionBody
				});
				permissionRequest.execute(function(resp) {});
			});
		}
		
		/**
		* Retrieve a list of File resources.
		*
		* @param {Function} callback Function to call when the request is complete.
		*/
		function retrieveAllFiles(callback) {
			console.log("retrieveAllFiles triggered");
			var retrievePageOfFiles = function(request, result) {
				request.execute(function(resp) {
					result = result.concat(resp.items);
					var nextPageToken = resp.nextPageToken;
					if (nextPageToken) {
						request = gapi.client.drive.files.list({
							"pageToken": nextPageToken
						});
						retrievePageOfFiles(request, result);
					} else {
						callback(result);
					}
				});
			}
			var initialRequest = gapi.client.drive.files.list();
			retrievePageOfFiles(initialRequest, []);
		}
		
		function foo(result) {
			console.log("foo triggered, result follows...");
			console.log(result);
		}
		function reportDrive() {
			console.log(gapi.client.drive);	
		}
	</script>
	<script type="text/javascript" src="https://apis.google.com/js/client.js?onload=onLoad"></script>
	<!--- <div class="row-fluid">
		<iframe id="driveGrid" src="https://drive.google.com/embeddedfolderview?id=0ByOEp31ChEw2VDBTSEg0UFhRRGc#grid" class="span12" style="height: 99%;" frameborder="0"></iframe>
	</div>
	<div class="row-fluid">
		<iframe id="driveList" src="https://drive.google.com/embeddedfolderview?id=0ByOEp31ChEw2VDBTSEg0UFhRRGc#list" class="span12" style="height: 99%;" frameborder="0"></iframe>
	</div> --->
	<!--- <input type="button" onclick="createPublicFolder('TOOLS')" value="Get Source"/> --->
<cfelse>

	<h3>Resources</h3>
	
	<h4>Scholarship Materials</h4>
	
	<p>2014-2015 materials coming soon</p>
	
	<!--- <ul class="nav nav-pills nav-stacked">
		<li><a href="http://www.calgrants.org/documents/2014_Cash_for_College_Scholarship_Award_Letter_Template.doc" target="_blank"><img src="common/icons/word_32.png" alt="" width="32" height="32" border="0" style="margin-right: 8px;" />2014 Cash for College Scholarship Award Letter Template</a></li>
		<li><a href="http://www.calgrants.org/documents/2014_Cash_for_College_Scholarship_FAQs.pdf" target="_blank"><img src="common/icons/pdf_32.png" alt="" width="32" height="32" border="0" style="margin-right: 8px;" />2014 Cash for College Scholarship FAQs</a></li>
		<li><!--- <a href="http://www.calgrants.org/documents/2014_Cash_for_College_Scholarship_Certificate.pdf" target="_blank"> ---><a href="#" onclick="alert('Certificates are being generated and will be ready shortly'); return false;" target="_blank"><img src="common/icons/pdf_32.png" alt="" width="32" height="32" border="0" style="margin-right: 8px;" />2014 Cash for College Scholarship Certificate</a><!--- </a> ---></li>
	</ul> --->
	
	<h4>Workshops Materials</h4>
	
	<p>2014-2015 materials coming soon</p>
	
	<!--- <ul class="nav nav-pills nav-stacked">
		<li><a href="http://www.calgrants.org/documents/2014_Cash_for_College_Exit_Survey.pdf" target="_blank"><img src="common/icons/pdf_32.png" alt="" width="32" height="32" border="0" style="margin-right: 8px;" />2014 Cash for College Student Exit Survey</a></li>
		<li><a href="http://www.calgrants.org/documents/2013-2014_Cash_for_College_Exit_Survey_Key.pdf" target="_blank"><img src="common/icons/pdf_32.png" alt="" width="32" height="32" border="0" style="margin-right: 8px;" />2014 Cash for College Student Exit Survey Key</a></li>
		<li><a href="http://www.calgrants.org/documents/2014_Cash_for_College_Exit_Survey_Instructions.pdf" target="_blank"><img src="common/icons/pdf_32.png" alt="" width="32" height="32" border="0" style="margin-right: 8px;" />2014 Cash for College Student Exit Survey Instructions</a></li>
		<li><a href="http://studentaid.ed.gov/sites/default/files/2014-15-fafsa-worksheet.pdf" target="_blank"><img src="common/icons/pdf_32.png" alt="" width="32" height="32" border="0" style="margin-right: 8px;" />2014-15 FAFSA on the Web Worksheet - English</a></li>
		<li><a href="http://studentaid.ed.gov/sites/default/files/2014-15-fafsa-
	worksheet-spanish.pdf" target="_blank"><img src="common/icons/pdf_32.png" alt="" width="32" height="32" border="0" style="margin-right: 8px;" />2014-15 FAFSA on the Web Worksheet - Spanish</a></li>
		<li><a href="http://www.calgrants.org/documents/2014-2015_FAFSA_On_The_Web_Presentation-English.ppt" target="_blank"><img src="common/icons/power_point_32.png" alt="" width="32" height="32" border="0" style="margin-right: 8px;" />2014-15 FAFSA On The Web Presentation - English</a></li>
		<li><a href="http://www.calgrants.org/documents/2014-2015_FAFSA_On_The_Web_Presentation-Spanish.ppt" target="_blank"><img src="common/icons/power_point_32.png" alt="" width="32" height="32" border="0" style="margin-right: 8px;" />2014-15 FAFSA On The Web Presentation - Spanish</a></li>
		<li><a href="http://www.calgrants.org/documents/2014-2015_FAFSA_Computer_Lab_Presentation-English.ppt" target="_blank"><img src="common/icons/power_point_32.png" alt="" width="32" height="32" border="0" style="margin-right: 8px;" />2014-15 FAFSA Computer Lab Presentation - English</a></li>
		<li><a href="" target="_blank" onclick="alert('This item is not yet available.  Please check back soon.'); return false"><img src="common/icons/power_point_32.png" alt="" width="32" height="32" border="0" style="margin-right: 8px;" />2014-15 FAFSA Computer Lab Presentation - Spanish</a></li>
		<li><a href="http://www.calgrants.org/documents/2014-2015_FAFSA_Computer_Lab_Presentation-English.ppt" target="_blank"><img src="common/icons/power_point_32.png" alt="" width="32" height="32" border="0" style="margin-right: 8px;" />2014-15 FAFSA Computer Lab Presentation - English</a></li>
		<li><a href="" target="_blank" onclick="alert('This item is not yet available.  Please check back soon.'); return false"><img src="common/icons/power_point_32.png" alt="" width="32" height="32" border="0" style="margin-right: 8px;" />2014-15 FAFSA Computer Lab Presentation - Spanish</a></li>	
		<li><a href="http://www.calgrants.org/documents/STC_Login_Pin_Card.pdf" target="_blank"><img src="common/icons/pdf_32.png" alt="" width="32" height="32" border="0" style="margin-right: 8px;" />CA Dream Act Student Login/Parent PIN Card</a></li>
	</ul> --->
	
	<h4>Follow Up Requests</h4>
	
	<h5>Materials</h5>
	
	<p>2014-2015 materials coming soon</p>
	
	<!--- <ul class="nav nav-pills nav-stacked">
		<li><a href="?view=followUpInstructions&printable=true" target="_blank"><img src="common/icons/url_32.png" alt="" width="32" height="32" border="0" style="margin-right: 8px;" />2014 Follow Up Instructions</a></li>
		<li><a href="http://www.calgrants.org/documents/2014_Cash_For_College_Follow_Up_Assistance_Script.pdf" target="_blank"><img src="common/icons/pdf_32.png" alt="" width="32" height="32" border="0" style="margin-right: 8px;" />2014 Follow Up Phone Script</a></li>
		<li><a href="http://www.calgrants.org/documents/2014_Cash_For_College_Follow_Up_Assistance_Voicemail_Script.pdf" target="_blank"><img src="common/icons/pdf_32.png" alt="" width="32" height="32" border="0" style="margin-right: 8px;" />2014 Follow Up Voicemail Script</a></li>
	</ul> --->
	
	<h5>Resources</h5>
	
	<p>2014-2015 materials coming soon</p>
	
	<!--- <ul class="nav nav-pills nav-stacked">
		<li><a href="http://www.calgrants.org/documents/Get_It_Done_20140327.mp3" target="_blank"><img src="common/icons/mp3_32.png" alt="" width="32" height="32" border="0" style="margin-right: 8px;" />Get it Done or Get Delayed audio</a></li>
		<li><a href="http://www.fafsa.gov" target="_blank"><img src="common/icons/url_32.png" alt="" width="32" height="32" border="0" style="margin-right: 8px;" />FAFSA website</a></li>
		<li><a href="http://www.calgrants.org" target="_blank"><img src="common/icons/url_32.png" alt="" width="32" height="32" border="0" style="margin-right: 8px;" />Cal Grants website</a></li>
		<li><a href="http://www.caldreamact.org" target="_blank"><img src="common/icons/url_32.png" alt="" width="32" height="32" border="0" style="margin-right: 8px;" />CA Dream Act application and signature page tutorial</a></li>
		<li><a href="http://www.csac.ca.gov/doc.asp?id=1122" target="_blank"><img src="common/icons/url_32.png" alt="" width="32" height="32" border="0" style="margin-right: 8px;" />Cal Grant Income and Asset Ceilings</a></li>
		<li><a href="http://www.publications.csac.ca.gov/common/files/products/65.CSAC%20Fund%20Your%20Future%20Brochure%20English.pdf" target="_blank"><img src="common/icons/pdf_32.png" alt="" width="32" height="32" border="0" style="margin-right: 8px;" />Fund Your Future Brochure - English</a></li>
		<li><a href="http://www.publications.csac.ca.gov/common/files/products/3.13-1819-FINAL%20CSAC%20Fund%20Your%20Future%20Brochure%20Spanish.pdf" target="_blank"><img src="common/icons/pdf_32.png" alt="" width="32" height="32" border="0" style="margin-right: 8px;" />Fund Your Future Brochure - Spanish</a></li>
		
		<li><a href="http://www.publications.csac.ca.gov/common/files/products/63.CSAC%2010%20Things%20Students%20ENG.Spanish%20G-121.pdf" target="_blank"><img src="common/icons/pdf_32.png" alt="" width="32" height="32" border="0" style="margin-right: 8px;" />Top Ten Tips on Cal Grants</a></li>
		<li><a href="http://www.publications.csac.ca.gov/common/files/products/47.CSAC%2010%20Things%20You-Dream%20Act%20ENGSP%20G-125%20(2).pdf" target="_blank"><img src="common/icons/pdf_32.png" alt="" width="32" height="32" border="0" style="margin-right: 8px;" />Top Ten Tips on the CA Dream Act</a></li>
		<li><a href="http://www.publications.csac.ca.gov/common/files/products/62.CSAC%20Middle%20Class%20Scholarship%20Flyer%20ENG.Spanish%20G-126.pdf" target="_blank"><img src="common/icons/pdf_32.png" alt="" width="32" height="32" border="0" style="margin-right: 8px;" />10 Things You Need to Know About California&prime;s Middle Class Scholarship</a></li>
	</ul> --->

</cfif>